package com.ibk.system.map;

import java.util.Vector;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.drawable.BitmapDrawable;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.Projection;
import com.ibk.system.R;

public class InformationOverlay extends Overlay {
	Vector<GeoPoint> flagList = new Vector<GeoPoint>();
	BitmapDrawable flag;

	private MapActivity activity;

	public InformationOverlay(MapActivity mainActivity) {
		activity = mainActivity;
		flag = (BitmapDrawable) mainActivity.getApplicationContext()
				.getResources().getDrawable(R.drawable.flag);
		//본점 - 37.566366, 126.986517
		//수지 - 37.341372,127.102203
		flagList.add(new GeoPoint((int)(37.566366 * 1E6), (int)(126.986517 * 1E6)));
		flagList.add(new GeoPoint((int)(37.341372 * 1E6), (int)(127.102203 * 1E6)));
	}

	@Override
	public void draw(Canvas canvas, MapView mapView, boolean shadow) {
		super.draw(canvas, mapView, shadow);

		Paint pnt = new Paint();
		pnt.setAntiAlias(true);

		Projection projection;
		projection = mapView.getProjection();

		// TODO : draw FootPrint logging
		Point tmp;
		int oldcolor = pnt.getColor();
		pnt.setColor(Color.RED);
		for (GeoPoint p : flagList) {
			tmp = projection.toPixels(p, null);
//			canvas.drawBitmap(flag.getBitmap(), tmp.x, tmp.y, pnt);
			canvas.drawCircle(tmp.x, tmp.y, 3, pnt);
		}
		pnt.setColor(oldcolor);
	}

}
